package com.yuyou.tas.lesson;

import javax.annotation.PreDestroy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.netflix.discovery.DiscoveryManager;
import com.yuyou.tas.util.tool.SpringUtil;

import feign.Logger;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
@EnableFeignClients(basePackages = {
		"com.yuyou.tas.service.api.admin.service",
		"com.yuyou.tas.service.api.report.service",
		"com.yuyou.tas.service.api.feedback.service"
		})
@EnableDiscoveryClient
@SpringBootApplication
@EnableTransactionManagement
public class TasLessonApplication {

    @Bean
    public SpringUtil springUtil(){
    	return new SpringUtil();
    }
	
    @Bean
    public Logger.Level feignLoggerLevel() {
        return feign.Logger.Level.FULL;
    }
	
	public static void main(String[] args) {
		SpringApplication.run(TasLessonApplication.class, args);
	}
	
	@SuppressWarnings("deprecation")
	@PreDestroy
	public void dostory() {
		DiscoveryManager.getInstance().shutdownComponent();
	}
	
}
